.class public Lcom/TwinBlade/PicturePassword/HomeChooser;
.super Landroid/app/Activity;
.source "SourceFile"

# interfaces
.implements Landroid/view/View$OnClickListener;


# instance fields
.field a:Landroid/widget/Button;

.field b:Landroid/widget/Button;

.field c:Landroid/widget/Button;

.field d:Landroid/widget/CheckBox;

.field private e:Landroid/content/pm/PackageManager;

.field private f:Landroid/content/ComponentName;

.field private g:Landroid/content/Context;

.field private h:Ljava/util/List;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 26
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    .line 36
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->h:Ljava/util/List;

    .line 26
    return-void
.end method

.method static synthetic a(Lcom/TwinBlade/PicturePassword/HomeChooser;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 34
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->g:Landroid/content/Context;

    return-object v0
.end method

.method private a()V
    .locals 7

    .prologue
    const/4 v3, 0x0

    .line 68
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    .line 70
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.MAIN"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 71
    const-string v1, "android.intent.category.HOME"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 72
    iget-object v1, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    invoke-virtual {v1, v0, v3}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v0

    .line 73
    if-eqz v0, :cond_1

    .line 74
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :cond_0
    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_2

    .line 92
    :cond_1
    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v0

    new-array v0, v0, [Ljava/lang/CharSequence;

    invoke-interface {v2, v0}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [Ljava/lang/CharSequence;

    .line 94
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 95
    const v2, 0x7f090093

    invoke-virtual {p0, v2}, Lcom/TwinBlade/PicturePassword/HomeChooser;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    .line 96
    new-instance v2, Lcom/TwinBlade/PicturePassword/ah;

    invoke-direct {v2, p0}, Lcom/TwinBlade/PicturePassword/ah;-><init>(Lcom/TwinBlade/PicturePassword/HomeChooser;)V

    invoke-virtual {v1, v0, v2}, Landroid/app/AlertDialog$Builder;->setItems([Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v0

    .line 102
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;

    .line 103
    return-void

    .line 74
    :cond_2
    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/pm/ResolveInfo;

    .line 76
    iget-object v1, v0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v1, v1, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    const-string v4, "com.TwinBlade.PicturePassword"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    .line 77
    const/4 v1, 0x0

    .line 79
    :try_start_0
    iget-object v4, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    iget-object v5, v0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v5, v5, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    const/4 v6, 0x0

    invoke-virtual {v4, v5, v6}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 83
    :goto_1
    iget-object v0, v0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    .line 84
    new-instance v4, Landroid/content/ComponentName;

    iget-object v5, v0, Landroid/content/pm/ActivityInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo;

    iget-object v5, v5, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    iget-object v0, v0, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    invoke-direct {v4, v5, v0}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 86
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->h:Ljava/util/List;

    invoke-virtual {v4}, Landroid/content/ComponentName;->flattenToString()Ljava/lang/String;

    move-result-object v4

    invoke-interface {v0, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 87
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->getApplicationLabel(Landroid/content/pm/ApplicationInfo;)Ljava/lang/CharSequence;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-interface {v2, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 80
    :catch_0
    move-exception v4

    goto :goto_1
.end method

.method static synthetic b(Lcom/TwinBlade/PicturePassword/HomeChooser;)Ljava/util/List;
    .locals 1
    .parameter

    .prologue
    .line 36
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->h:Ljava/util/List;

    return-object v0
.end method


# virtual methods
.method public onClick(Landroid/view/View;)V
    .locals 4
    .parameter

    .prologue
    const/4 v3, 0x0

    const/4 v2, 0x1

    .line 106
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 126
    :goto_0
    return-void

    .line 108
    :pswitch_0
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    iget-object v1, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->f:Landroid/content/ComponentName;

    invoke-virtual {v0, v1, v2, v2}, Landroid/content/pm/PackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;II)V

    .line 109
    sput-boolean v3, Lcom/TwinBlade/PicturePassword/Utilities;->a:Z

    .line 111
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.MAIN"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 112
    const-string v1, "android.intent.category.HOME"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 113
    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->startActivity(Landroid/content/Intent;)V

    .line 115
    const v0, 0x7f0900ac

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->getString(I)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x3

    invoke-static {p0, v0, v1, v2}, Lcom/TwinBlade/PicturePassword/Utilities;->a(Landroid/content/Context;Ljava/lang/String;IZ)V

    goto :goto_0

    .line 119
    :pswitch_1
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    iget-object v1, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->f:Landroid/content/ComponentName;

    invoke-virtual {v0, v1, v3, v2}, Landroid/content/pm/PackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;II)V

    goto :goto_0

    .line 123
    :pswitch_2
    invoke-direct {p0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->a()V

    goto :goto_0

    .line 106
    :pswitch_data_0
    .packed-switch 0x7f080014
        :pswitch_2
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 4
    .parameter

    .prologue
    .line 40
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 41
    const v0, 0x7f030004

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->setContentView(I)V

    .line 43
    iput-object p0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->g:Landroid/content/Context;

    .line 44
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->e:Landroid/content/pm/PackageManager;

    .line 45
    new-instance v0, Landroid/content/ComponentName;

    const-string v1, "com.TwinBlade.PicturePassword"

    .line 46
    const-string v2, "com.TwinBlade.PicturePassword.HomeLauncher"

    invoke-direct {v0, v1, v2}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 45
    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->f:Landroid/content/ComponentName;

    .line 48
    const v0, 0x7f080015

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->a:Landroid/widget/Button;

    .line 49
    const v0, 0x7f080016

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->b:Landroid/widget/Button;

    .line 50
    const v0, 0x7f080014

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->c:Landroid/widget/Button;

    .line 51
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->a:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 52
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->b:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 53
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->c:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 55
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 56
    const v0, 0x7f080012

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/HomeChooser;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/CheckBox;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->d:Landroid/widget/CheckBox;

    .line 57
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->d:Landroid/widget/CheckBox;

    const-string v2, "StartOnBoot"

    const/4 v3, 0x1

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v2

    invoke-virtual {v0, v2}, Landroid/widget/CheckBox;->setChecked(Z)V

    .line 58
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/HomeChooser;->d:Landroid/widget/CheckBox;

    new-instance v2, Lcom/TwinBlade/PicturePassword/ag;

    invoke-direct {v2, p0, v1}, Lcom/TwinBlade/PicturePassword/ag;-><init>(Lcom/TwinBlade/PicturePassword/HomeChooser;Landroid/content/SharedPreferences;)V

    invoke-virtual {v0, v2}, Landroid/widget/CheckBox;->setOnCheckedChangeListener(Landroid/widget/CompoundButton$OnCheckedChangeListener;)V

    .line 64
    return-void
.end method
